//
//  AXFAddLocationController.m
//  AXFEightGroup
//
//  Created by hgj on 2016/12/23.
//  Copyright © 2016年 ya. All rights reserved.
//

#import "AXFAddLocationController.h"


static NSString *cell_id = @"cell";

@interface AXFAddLocationController ()<UITableViewDelegate, UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITextField *accept_name_txf;
@property (weak, nonatomic) IBOutlet UIButton *manSelected_btn;
@property (weak, nonatomic) IBOutlet UIButton *womenSelected_btn;
@property (weak, nonatomic) IBOutlet UITextField *telphone_txf;
@property (weak, nonatomic) IBOutlet UITextField *city_txf;
@property (weak, nonatomic) IBOutlet UITextField *district_txf;
@property (weak, nonatomic) IBOutlet UITextField *address_txf;

@property (nonatomic, strong) NSOperationQueue *queue;
//@property (nonatomic, strong) NSMutableArray *addressArray;

@end

@implementation AXFAddLocationController {
    AXFDataModel *_DataModel;
    UIButton *_oldBtn;
}

- (NSOperationQueue *)queue {
    if (_queue) {
        _queue = [[NSOperationQueue alloc] init];
    }
    return _queue;
}

- (void)viewDidLoad {
    [super viewDidLoad];
   
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"我的收货地址";
    
//    self.addressArray = [NSMutableArray array];
    
    [self setupUI];
}

- (void)setupUI {
    
    self.tableView.tableFooterView = [UIView new];
    
    // 保存 
    UIBarButtonItem *save = [[UIBarButtonItem alloc] initWithTitle:@"保存" style:UIBarButtonItemStylePlain target:self action:@selector(saveInfo:)];
    [save setTintColor:[UIColor darkGrayColor]];
    self.navigationItem.rightBarButtonItem = save;
}

- (void)saveInfo:(UIBarButtonItem *)item {
    
    AXFDataModel *model = [[AXFDataModel alloc] init];
    
    model.accept_name = _accept_name_txf.text;
    model.telphone = _telphone_txf.text;
    model.city_name = _city_txf.text;
    model.district_name = _district_txf.text;
    model.address = _address_txf.text;
    

    
    if (_Block) {
        self.Block(model);
    }
    
    [self.navigationController popViewControllerAnimated:YES];
    
}

- (IBAction)genderSelect:(UIButton *)sender {
    
    sender.selected = !sender.selected;
    if (_oldBtn == sender) {
        return;
    }
    _oldBtn = sender;
    if (sender == _manSelected_btn) {
        _womenSelected_btn.selected = !sender.selected;
    } else {
        _manSelected_btn.selected = !sender.selected;
    }
}


- (IBAction)selectCity:(UITextField *)sender {
    
}

@end
